package com.qian.ddj.web.controller;

import com.qian.api.ddj.model.Config;
import com.qian.api.ddj.service.IConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * created by quziwei on 2018/3/12 0012  13:57
 */
@RestController
@RequestMapping("/ddj/config")
@Api(tags = "网站配置")
public class ConfigController {

    @Autowired
    private IConfigService configService;
    @ApiOperation("保存")
    @PostMapping
    public void save(Config config){
        configService.save(config);
    }
    @ApiOperation("查所有")
    @GetMapping
    public List<Config> findAll(){
        List<Config> lists = configService.findAll();
        return lists;
    }
    @ApiOperation("删除")
    @DeleteMapping
    public void delete(Integer id){
        configService.deleteById(id);
    }
}
